import Vue from 'vue'
import VueRouter from 'vue-router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    redirect: "/login"
  },
  {
    path:"/login",
    name:"login",
    component:()=>import("../views/login/index.vue")
  },{
    path:"/home",
    name:"home",
    component:()=>import("../views/home/index.vue"),
    children:[
      {
        path:"/home/user",
        name:"user",
        component:()=>import("../views/user/index.vue")
      },
      {
        path:"/home/adduser",
        name:"adduser",
        component:()=>import("../views/adduser/index.vue")
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
